import java.util.HashMap;
import java.util.Map;

// 双指针
class Solution1 {
    public int maxArea(int[] height) {
        int l = 0, r = height.length - 1;
        int ans = 0;
        while (l < r) {
            int area = Math.min(height[l], height[r]) * (r - l);
            ans = Math.max(ans, area);
            if (height[l] <= height[r]) {
                ++l;
            }
            else {
                --r;
            }
        }
        return ans;
    }
}


class MySolution {
    public int maxArea(int[] height) {
        Map<Integer, Integer> hashMap = new HashMap<Integer, Integer>();
        for (int i = 0; i <= height.length - 1; i++) {
            hashMap.put(i, height[i]);
        }
    }
}

class Solution {
    public int maxArea(int[] height) {
        int s = 0;
        int cache = 0;
        for (int i = 0; i <= height.length - 2; i++) {
            for (int j = i + 1; j <= height.length - 1; j++) {
                cache = height[i] < height[j] ? (j - i) * height[i] : (j - i) * height[j];
                s = s < cache ? cache : s;
                cache = 0;
            }
        }
        return s;
    }
}